import java.util.Random;

public class NonDuplicatedArray {
	int[] ary = null;
	int currentIndex = 0;
	
	public NonDuplicatedArray(int n, int start, int end)
	{
		ary = new int[n];
		Random r = new Random();
		
		// Generated n non-duplicated numbers
		while (currentIndex < n)
		{
			int currentNum = r.nextInt(end - start + 1) + start;
			
			if (! hasNumber(currentNum))
				ary[currentIndex++] = currentNum;
		}
	}
	
	public int[] getArray()
	{
		return ary;
	}

	private boolean hasNumber(int num) {
		
		for (int i=0; i<currentIndex; i++)
			if (ary[i] == num)
				return true;

		return false;
	}
	
	public String toString()
	{
		StringBuffer str = new StringBuffer();
		
		for (int i=0; i<ary.length; i++)
			str.append(ary[i] + " ");
		
		return str.toString();
	}
}
